package thinking.exception;

/**
 * <Thinking in Java> 验证final语句是否在return后执行
 * 测试结果：return后final就不执行了
 */
public class MultipleReturns {
     public static void f(int i) {
         System.out.println("Initialization that requires cleanup");
         try {
             System.out.print("Point 1 ");
             if (i == 1) return;
             System.out.print("Point 2 ");
             if (i == 2) return;
             System.out.print("Point 3 ");
             if (i == 3) return;
             System.out.print("End ");
         } finally {
             System.out.println("Performing cleanup");
         }
     }

    public static void main(String[] args) {
        for (int i = 1; i <= 4; i++)
            f(i);
    }
}
